<%-- 
    Document   : index
    Created on : 04/11/2011, 14:08:07
    Author     : great
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Cadastrar User</h1>


        <form name="login" action="addUser" method="post"  >
            <fieldset>
                <legend> Login </legend>
                <label >Name: </label>
                <input id="name" type="text" name="user.name" /> <br />

                <label for="pass">E-mail: </label>
                <input id="email" type="text" name="user.email" /> <br />

                <label for="login">Login: </label>
                <input id="login" type="text" name="user.login" /> <br />

                <label for="pass">Pass: </label>
                <input id="pass" type="password" name="user.pass" onchange="verifyPass()" /> <br />

                <label for="pass">Confirm pass: </label>
                <input id="pass2" type="password" name="pass2" onchange="verifyPass()" /> <br />

                <script>
                    function verifyPass(button) { //Se o usuário ativar o botão e depois mudar a senha, dá certo!
                        if(document.login.pass.value == "") alert("Complete the pass field");
                        else if(document.login.pass.value == document.login.pass2.value) {
                            document.getElementById("btSubmit").disabled = false;
                        }else{
                            alert("The entered passwords are different");
                        }
                        return true;    
                    }
                    
                    
                </script>


                <button id="btSubmit" type="submit" disabled="true"  >Register</button> <br />
                <button id="btBack" type="submit" onclick="back()" >Back to login</button> <br />
                <label >*Complete all fields to show the button</label>
            </fieldset>
        </form>
    </body>
</html>
